<extend name="common:base" />
<block name="content">
    <div id="header">
        <div class="header">
            <h1 class="tit">{$site_title}</h1>
            <!--<p class="goback">-->
                <!--<a class="return" href="javascript:history.go(-1);">返回</a>-->
            <!--</p>-->
            <!--<p class="more"><a class="share" href=""></a></p>-->
        </div>
    </div>
    <div class="banx-a">
        <ul class="uls">
            <li><a href="{:U('Customers/index')}" <if condition="$by eq ''">class="page_active"</if>>未联系</a></li>
            <li><a href="{:U('Customers/index', array('by' =>'contact'))}" <if condition="$by eq 'contact'">class="page_active"</if>>已联系</a></li>
            <li><a href="{:U('Customers/index', array('by' =>'conversion'))}" <if condition="$by eq 'conversion'">class="page_active"</if>>已转化</a></li>
        </ul>
        <div class="zm" id="mescroll">
            <ul id="dataList">
                <foreach name="cuslist" item="cus">
                    <a href="{:U('Customers/mem_view' ,array('id'=> $cus['member_id']))}">
                        <li>{$cus['member_name']}
                            <span class="fright">
                                <if condition="$cus['mobile'] neq ''">
                                    手机：{$cus['mobile']}
                                    <else/>
                                    微信：{$cus['wx']}
                                </if>
                            </span>
                        </li>
                    </a>
                </foreach>
            </ul>
        </div>
    </div>
    <div class="dropload-load" id="loading" style="display: none;"><span class="loading"></span>加载中...</div>
    <empty name="cuslist">
        <div class="no_data">
            <img src="{:C('__STATIC__')}{$theme}/Static/img/no_data.png" class="tip_img"/>
            <p class="tip_txt">暂时没有相关信息</p>
        </div>
    </empty>
</block>
<block name="CSS">
    <link rel="stylesheet" href="{:C('__STATIC__')}{$theme}/Static/{:C('css')}/khlb-wlx.css" />
</block>

<block name="JS">
    <script type="text/javascript">
        $(function() {
            function switchstatus(i,obj) {
                    if (!($(obj).hasClass("page_active"))) {
                        $(obj).addClass("page_active");
                        $(obj).parent().siblings().find("a").removeClass("page_active");
                    }
                    if(i == "1") {
                        $('.ready').show();
                        $('.past').hide();
                        $('.my').hide();
                    }else if(i == "2"){
                        $('.ready').hide();
                        $('.past').show();
                        $('.my').hide();
                    }else{
                        $('.ready').hide();
                        $('.past').hide();
                        $('.my').show();
                    }
                }


//            /*设置列表数据*/
//            function setListData(data){
//                var listDom = document.getElementById("dataList");
//                for (var i = 0; i < data.length; i++) {
//                    var pd = data[i];
//
//                    var str = '<a href="{:U('Customers/mem_view')}&id='+pd.member_id+'">';
//                    str += "<li>" + pd.member_name;
//                    str += '<span class="fright">';
//                    if(pd.mobile != ''){
//                        str += "手机：" + pd.mobile;
//                    }else{
//                        str += "微信：" + pd.wx;
//                    }
//                    str += '</span>';
//                    str += '</li>';
//                    str += '</a>';
//
//                    var liDom = document.createElement("li");
//                    liDom.innerHTML = str;
//                    listDom.appendChild(liDom);//加在列表的后面,上拉加载
//                }
//            }

            var pagenum = 1;
            $(window).scroll(function(){

                var scrollTop = $(this).scrollTop();
                var scrollHeight = $(document).height();
                var windowHeight = $(this).height();

                if(scrollTop + windowHeight == scrollHeight){
                    pagenum += 1;
                    $.ajax({
                        url:"{:U('Customers/get_more')}",
                        type: "post",
                        data: {
                            params: "{$params}",
                            page:pagenum
                        },
                        success: function(data) {
                            $('#loading').show();
                            setTimeout(function(){
                                if(data){
                                    setListData(data)
                                }else{
                                    $("#loading").text("亲没有更多的数据了！");
                                    $("#loading").show();
                                }
                            }, 700);
                        }
                    });
                }
            });

        });
    </script>
</block>